﻿package org.openChart.sprite.elements 
{
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.system.IMEConversionMode;
	import flash.text.TextField;
	import org.openChart.display.DisplayElement;
	import org.openChart.display.chart.DisplayBarElement;
	import org.openChart.sprite.CommandHandler;
	import org.openChart.sprite.util.HeightHelper;
	
	/**
	 * 
	 * @author Chongyuan Yang
	 */
	public class Bar2d extends BarElementSprite
	{
		public static var i:uint = 0;
		private var element_height_:Number;
		public function Bar2d( displayElement:DisplayElement, commandHandler:CommandHandler)
		{
			super(displayElement, commandHandler);
			var barElement:DisplayBarElement = displayElement as DisplayBarElement;
			//element_height_ = barElement.height;
			//paint();
			var helper:HeightHelper = new HeightHelper(this, barElement.height, 15000);
		}
		
		public override function paint() :void
		{
			//trace(element_height_);
			var displayElement:DisplayBarElement = displayObject as DisplayBarElement;
			graphics.clear();
			fillRectangle(displayElement.position.x, displayElement.position.y, displayElement.width, 0 - element_height_, color);
		}
		
		public function set elementHeight( element_height_:Number ):void
		{
			this.element_height_ = element_height_;
			repaint();
		}
		
		public function get elementHeight():Number
		{
			return element_height_;
		}
	}
	
}